package com.baizhiedu.baizhiappsys.orm;

import com.baizhiedu.baizhiappsys.entity.Course;
import com.baizhiedu.baizhiappsys.entity.User;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.lang.Nullable;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Date;


/**
 * @author lby
 */
public class CourseRowMapper implements RowMapper<Course> {

    @Nullable
    @Override
    public Course mapRow(ResultSet resultSet, int i) throws SQLException {
        Long courseId = resultSet.getLong(1);
        String courseName = resultSet.getString(2);
        String courseIntroduction = resultSet.getString(3);
        Integer courseNumberStudents = resultSet.getInt(4);
        Double coursePrice = resultSet.getDouble(5);
        String courseTeacher = resultSet.getString(6);
        Integer courseClickVolume = resultSet.getInt(7);
        Long categoryId = resultSet.getLong(8);
        return new Course(courseId,courseName,courseIntroduction,courseNumberStudents,coursePrice,courseTeacher,courseClickVolume,categoryId);
    }
}
